Repository navigation
fix(studio): fetch identity services with redirect: 'manual' - #110
Open
rubenkalath wants to merge 1 commit into
Open
rubenkalath wants to merge 1 commit into
rubenkalath wants to merge 1 commit into
Conversation
The Workers runtime refuses redirect: 'error' ("won't be implemented"),
so OIDC discovery, JWKS and token fetches all failed as network errors and
Google and OIDC sign-in could not complete. A 3xx answer is not ok, so it
is still refused rather than followed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
AUTH_PROVIDER=oidc, and by the same code pathgoogle, pressing the sign-in button logsStudio auth provider failed { provider: 'oidc', step: 'begin' }and the person stays on the sign-in page.studio/src/features/auth/providers/boundedFetch.tscalls the fetcher withredirect: 'error'. The Workers runtime refuses that value before anything is sent:fetchJsoncatches the error and returns{ kind: 'network' }. As a result, OIDC discovery, the JWKS fetch and the token exchange all fail. These areoidcFlow.tsandjwks.ts, used by bothoidc.tsandgoogle.ts. Unit tests pass because they run under Node, whosefetchaccepts'error'.Reproduced under workerd 2026-10-12 (Miniflare 5.20261012.1-beta, the version Studio pins), with compatibility date 2026-10-16 and
nodejs_compat.Fix
boundedFetch.ts: useredirect: 'manual'instead of'error'. A 3xx answer is notok, sofetchJsonstill refuses it ({ kind: 'status', status }) and never follows it. That keeps the point of the old setting: a redirect cannot carry a client secret elsewhere.studio/test/boundedFetchRedirect.test.ts: checks the fetcher is asked formanual, and that a 302 is a status failure.Checks
tsc --noEmit, ESLint and Prettier on the changed files.tsx --test test/boundedFetchRedirect.test.ts: 2 pass.redirect: 'error'also appears inpublishing/publishStatusRemote.ts,publishing/deployment.tsandpreview/renderPushServer.ts. Any of those that runs in the Worker rather than in the container (Node) would fail the same way. Not changed here.